package com.rd.student.jike.class4.xiayinyin.day0807;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;

public class Demo06 {
    public static void main(String[] args) throws IOException {
//        int[] arr1 = new int[35];
//        int[] arr2 = new int[12];
//        int a = 1;
//        int b = 1;
//        for (int i = 0; i < 35; i++) {
//            arr1[i] = a;
//            a++;
//        }
//        for (int i = 0; i < 12; i++) {
//            arr2[i] = b;
//            b++;
//        }
        File file = new File("daletou.txt");
        Writer writer = new FileWriter(file);
        String[] arr1 = random();
        writer.write(Arrays.toString(arr1));
        writer.close();
        for (int i = 0; i < 100; i++) {
            String[] arr2 = random();
            System.out.println(Arrays.toString(arr2));
        }
    }

    public static String[] random() {
        int[] arr1 = new int[5];
        for (int i = 0; i < 5; i++) {
            int c = (int)(Math.random() * 35 + 1);
            boolean a = true;
            for (int j = 0; j < i; j++) {
                if (c == arr1[j]) {
                    a = false;
                    i--;
                    break;
                }
            }
            if(a)
            arr1[i] = c;
        }
        int[] arr2 = new int[2];
        for (int i = 0; i < 2; i++) {
            int c = (int) (Math.random() * 12 + 1);
            boolean a = true;
            for (int j = 0; j < i; j++) {
                if (c == arr2[j]) {
                    a = false;
                    i--;
                    break;
                }
            }
            if (a)
            arr2[i] = c;
        }
        int[] arr3 = new int[8];
//        System.out.println(Arrays.toString(arr1));
//        System.out.println(Arrays.toString(arr2));
        System.arraycopy(arr1,0,arr3,0,arr1.length);
        System.arraycopy(arr2,0,arr3,arr1.length+1,arr2.length);
        String[] arr4= new String[8];
        for (int i = 0; i < arr4.length; i++) {
            arr4[i] = ""+arr3[i];
        }
        arr4[arr1.length] = "|";
        return arr4;
    }
}
